import java.util.Scanner;

class Pizza{
    public static final String STORE_NAME="开心披萨店";
    private String name;//名字
    private double price;//价格
    private int size;//大小
    public Pizza(String name,double price,int size){
        this.name = name;
        this.price = price;
        this.size = size;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    @Override
    public String toString() {
        return "***"+STORE_NAME+"****\n购买信息：\n披萨名称："+name+"\n披萨大小："+size+"寸\n披萨价格："+price+"元";
    }
}
class FruitsPizza extends Pizza{//水果披萨
    private String fruitsMaterial;//要添加的水果
    public FruitsPizza(String name, double price, int size,String fruitsMaterial) {
        super(name, price, size);
        this.fruitsMaterial = fruitsMaterial;
    }

    public String getFruitsMaterial() {
        return fruitsMaterial;
    }

    public void setFruitsMaterial(String fruitsMaterial) {
        this.fruitsMaterial = fruitsMaterial;
    }

    @Override
    public String toString() {
        return super.toString()+"\n要添加的水果材料："+fruitsMaterial;
    }
}
class BaconPizza extends Pizza{//培根披萨

    public BaconPizza(String name, double price, int size) {
        super(name, price, size);
    }
}
class MainView{
    Scanner sc = new Scanner(System.in);

    public void start() {
        while (true){
            System.out.println("请输入要买的披萨：1.水果披萨 2.培根披萨");
            int num = sc.nextInt();
            switch (num){
                case 1:
                    showView(1);
                    break;
                case 2:
                    showView(2);
                    break;
                default:
                    System.out.println("输入功能编号错误");
            }
        }
    }
    public void showView(int type){
        String m = null;
        if (type == 1) {
            System.out.println("请输入要加的水果材料：");
            m=sc.next();
        }
        System.out.println("请输入购买尺寸：");
        int sixe=sc.nextInt();
        System.out.println("请输入价格：");
        double price = sc.nextDouble();
        if (type == 1) {
            FruitsPizza f = new FruitsPizza("水果披萨",price,sixe,m);
            System.out.println(f);
        }else {
            System.out.println(new BaconPizza("培根披萨",price,sixe));
        }
        System.out.println("********************************************");
    }
}